<?php
namespace app\home\controller;

use core\Controller;


class Hello extends Controller {
//    public function index() {
//        echo 'Hello.index()';
//    }

    public function world() {
        echo 'Hello.world()';
    }


    public function view() {
        $this->assign('name', '老王');
        $this->assign('varIf', true);
        $this->assign('varFor', 5);
        $this->assign('varForeach', ['php', 'html']);

        $this->import();
    }

    public function view2() {
        $this->assign('name', '老宋');

        $this->import('hello/view2.phtml');
    }


    public function twig() {
        $this->assign('name', '老王');
        $this->assign('varIf', true);
        $this->assign('varFor', 5);
        $this->assign('varForeach', ['php', 'html']);
        $this->import();
    }

    public function twig2() {
        $this->assign('name', '老宋');
        $this->import('hello/twig2.html');
    }


    public function log() {
        $this->debug('debug 日志来自 Hello.log');
        $this->info('info 日志来自 Hello.log');
        $this->error('error 日志来自 Hello.log', ['name' => 'five', 'age' => 18]);
    }

    public function log2() {
        $this->logCreate('log2.log');

        $this->debug('debug 日志来自 Hello.log2');
        $this->info('info 日志来自 Hello.log2');
        $this->error('error 日志来自 Hello.log2', ['name' => 'five', 'age' => 18]);
    }
}
